﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using GPTAS.Database;
using GPTAS.Core;

namespace GPTASUI
{
    public partial class NewGroupNames : Form
    {
        public NewGroupNames()
        {
            InitializeComponent();
        }

        private void NewGroupNames_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < NewAllocation.noofgroups; i++)
            {
                AppSetting a = new AppSetting();
                a.lblSetting.Text = "Name of Group" + (i+1);
                flpGroupNames.Controls.Add(a);
            }
        }

        private void btnSaveGroupNames_Click(object sender, EventArgs e)
        {
            int result = 0;
            foreach (Control c in flpGroupNames.Controls)
            {
                if (c is AppSetting)
                {
                    AppSetting a = c as AppSetting;
                    result=Database.Instance.NewGroup(Allocator.Instance.CurrentAllocationId,a.txtValue.Text);                    
                }
            }
            if (result > 0)
            {
                
            }
        }
    }
}
